package com.tamecode.bean.attr;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ParentAndSubContain {
    public static void main(String[] args) {
        // 1 父容器
        ClassPathXmlApplicationContext pApplicationContext = new ClassPathXmlApplicationContext("bean/attr/beans1.xml");
        // 2 子容器，并指定父容器
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"bean/attr/beans2.xml"}, pApplicationContext);
        Boss boss = applicationContext.getBean(Boss.class);
        System.out.println(boss.getCar().toString());
        // Car{brand='BYD 宋', price=20000.00, maxSpeed=200}
    }
}
